package com.graph;

/*
 * Taranjeet singh Bhatia
 * Code For Assignment # 4
 * GraphClass.java class
 */

public class GraphClass {

	/**
	 * @param args
	 */

	int vertex; // number of vertex in graph
	int[][] adjMaxtrix; // Adjacency matrix

	public GraphClass(int vertex) {
		super();
		this.vertex = vertex;
		this.adjMaxtrix = new int[this.vertex][this.vertex];
		// matrix initialization to 0
		for (int i = 0; i < this.vertex; i++) {
			for (int j = 0; j < this.vertex; j++) {
				this.adjMaxtrix[i][j] = 0;
			}
		}
	}

	public void addEdge(int v1, int v2, int weight) {
		this.adjMaxtrix[v1][v2] = weight;
		this.adjMaxtrix[v2][v1] = weight;
	}

	public void removeEdge(int v1, int v2) {
		this.adjMaxtrix[v1][v2] = 0;
		this.adjMaxtrix[v2][v1] = 0;
	}

	/**
	 * @return the vertex
	 */
	public int getVertex() {
		return this.vertex;
	}

	/**
	 * @param the
	 *            vertex to set
	 */
	public void setVertex(int vertex) {
		this.vertex = vertex;
	}

	/**
	 * @return the adjMaxtrix
	 */
	public int[][] getAdjMaxtrix() {
		return adjMaxtrix;
	}

	/**
	 * @param the
	 *            adjMaxtrix to set
	 */
	public void setAdjMaxtrix(int[][] adjMaxtrix) {
		this.adjMaxtrix = adjMaxtrix;
	}

	public boolean isEdge(int u, int v) {
		if (this.adjMaxtrix[u][v] == 0)
			return false;
		return true;
	}

	public int getEdgeWeight(int u, int v) {
		return this.adjMaxtrix[u][v];
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
